package com.axc.gallery2;

import com.axc.gallery2.camera.activity.CameraResultactivity;
import com.axc.gallery2.edit.EditActivity;
import com.axc.gallery2.net.activity.NetAlbumsActivity;
import com.axc.gallery2.net.activity.UploadPhotosActivity;
import com.axc.gallery2.view.GridViewActivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.animation.AlphaAnimation;
import android.view.animation.AnimationSet;
import android.view.animation.ScaleAnimation;

public class IndexActivity extends Activity{

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		// 设置不显示标题栏
		requestWindowFeature(Window.FEATURE_NO_TITLE);

		//设置布局
		setContentView(R.layout.activity_index);
		setView();
	}

	private void setView() {

		OnClickListener onClickListener =new OnClickListener() {

			@Override
			public void onClick(View v) {
				//设置动画
				ScaleAnimation animation=new ScaleAnimation(0.8f, 1.1f, 0.8f, 1.1f, 80,80);
				AlphaAnimation animation2 =new AlphaAnimation(0.5f, 1);
				animation2.setDuration(1000);
				animation.setDuration(1000);
				AnimationSet animationSet; animationSet=new AnimationSet(true);
				animationSet.addAnimation(animation);
				animationSet.addAnimation(animation2);
				animationSet.setDuration(1000);
				v.setAnimation(animationSet);
				switch (v.getId()) {
				//关于应用
				case R.id.index_a:
					startActivity(new Intent(IndexActivity.this, AboutActivity.class));
					break;
				//编辑
				case R.id.index_e:
					startActivity(new Intent(IndexActivity.this, EditActivity.class));
					break;
				//网络相册
				case R.id.index_w:
					startActivity(new Intent(IndexActivity.this, NetAlbumsActivity.class));
					break;
				//存档图库
				case R.id.index_s:
					Intent intent =new Intent(IndexActivity.this, GridViewActivity.class);
					intent.putExtra(GridViewActivity.TYPE_ID, "");
					startActivity(intent);
					break;
				//上传
				case R.id.index_u:
					startActivity(new Intent(IndexActivity.this, UploadPhotosActivity.class));
					break;
				//图册
				case R.id.index_l:
					startActivity(new Intent(IndexActivity.this, GridViewActivity.class));
					break;
				//拍照
				case R.id.index_c:
					startActivity(new Intent(IndexActivity.this, CameraResultactivity.class));
					break;
				//主题
				case R.id.index_t:
					startActivity(new Intent(IndexActivity.this, ThemeChoice.class));
					break;
				default:
					break;
				}
			}
		};
		View index_l = findViewById(R.id.index_l);
		index_l.setOnClickListener(onClickListener);

		View index_w = findViewById(R.id.index_w);
		index_w.setOnClickListener(onClickListener);

		View index_e = findViewById(R.id.index_e);
		index_e.setOnClickListener(onClickListener);

		View index_u = findViewById(R.id.index_u);
		index_u.setOnClickListener(onClickListener);

		View index_c = findViewById(R.id.index_c);
		index_c.setOnClickListener(onClickListener);

		View index_a = findViewById(R.id.index_a);
		index_a.setOnClickListener(onClickListener);

		View index_s = findViewById(R.id.index_s);
		index_s.setOnClickListener(onClickListener);

		View index_t = findViewById(R.id.index_t);
		index_t.setOnClickListener(onClickListener);

	}



}
